package com.sn.springboot_netty.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

/**
 * @Author fyy
 * @Description
 * @Date 2020/5/29 10:47
 */
public class FileUtil {

    public static Logger logger = LoggerFactory.getLogger(FileUtil.class);

    /**
     * @Author fyy
     * @Description 清空文件夹并删除
     * @Date 2020/5/29 10:48
     */
    public static boolean delFolder(File folder){
        if(folder.exists()){
            if(folder.isFile()){
                return folder.delete();
            }else{
                for (File file : folder.listFiles()) {
                    delFolder(file);
                }
            }
            folder.delete();
        }
        return false;
    }

}
